﻿namespace DataScripter.Excel.Formulas
{
	internal class Value : Formula
	{
		private readonly decimal _d;
		private readonly string _textValue;

		public Value(decimal d)
		{
			_d = d;
		}

		public Value(string s)
		{
			_textValue = s;
		}

		#region Overrides of Formula

		public override string Resolve(ICell current)
		{
		    return _textValue ?? _d.ToString();
		}

	    #endregion

		public override string ToString()
		{
			return _textValue ?? _d.ToString();
		}
	}
}